package com.geekstudy;

import org.apache.catalina.Globals;
import org.apache.catalina.startup.Bootstrap;
import org.apache.catalina.startup.Tomcat;

/**
 *
 * https://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.html
 *
 *
 */
public class DemoTomcatMain {


    public static void main(String[] args) {

        System.out.println("测试开始 demo Tomcat main");

        // https://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.html

        String tomcatHome = "/Users/lidongxu/software_demo/apache-tomcat-9.0.0.M26-demo2021";
        System.setProperty(Globals.CATALINA_BASE_PROP, tomcatHome);
        System.setProperty(Globals.CATALINA_HOME_PROP, tomcatHome);

        // System.getProperty(Globals.CATALINA_BASE_PROP)
        // System.setProperty(Globals.CATALINA_BASE_PROP, "demoTomcat/tomcat9");
        //警告: Unable to load server configuration from [/Users/lidongxu/code/gitee/geekstudy/java_practice/demoTomcat/conf/server.xml]
        //java.io.FileNotFoundException: /Users/lidongxu/code/gitee/geekstudy/java_practice/demoTomcat/conf/server.xml (No such file or directory)
        // System.setProperty(Globals.CATALINA_HOME_PROP, "demoTomcat/tomcat9");

        Bootstrap.main(args);

        // 警告: Unable to load server configuration from [/Users/lidongxu/code/gitee/geekstudy/java_practice/conf/server.xml]
        // java.io.FileNotFoundException: /Users/lidongxu/code/gitee/geekstudy/java_practice/conf/server.xml (No such file or directory)
        // at java.io.FileInputStream.open0(Native Method)
        // at java.io.FileInputStream.open(FileInputStream.java:195)
        // at java.io.FileInputStream.<init>(FileInputStream.java:138)
        // at java.io.FileInputStream.<init>(FileInputStream.java:93)
        //


    }
}
